package com.lanlian.cayman.adapter;

import android.support.annotation.Nullable;
import android.widget.ImageView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.lanlian.commonlib.bean.InformationInfo;
import com.lanlian.commonlib.common.SystemConfig;
import com.lanlian.cayman.R;
import com.lanlian.imagelib.ShowImageUtils;

import java.util.List;

/**
 * <pre>
 *     author : huxiaobo
 *     e-mail : huxiaobo@xlanlian.com
 *     date   : 2018/8/31 15:43
 *     desc   : todo
 *     version: 1.0
 * </pre>
 */
public class NewsflashAdapter extends BaseQuickAdapter<InformationInfo, BaseViewHolder> {

    public NewsflashAdapter(int layoutResId, @Nullable List<InformationInfo> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, InformationInfo item) {
        ImageView img = helper.getView(R.id.img);
        ShowImageUtils.showImageView(mContext, item.getImgurl(),
                SystemConfig.IMG_DEFAULT_BACKGROUND, img);
        helper.setText(R.id.tv_title, item.getTitle());
        helper.setText(R.id.tv_content, item.getDescription());
        helper.setText(R.id.tv_time, item.getUpdatetime());
    }
}
